package com.etlmaster.executor.steps.web;

import org.springframework.web.client.RestTemplate;

/**
 * @author Larry
 * @copyright Larry@etlMaster
 * @since 2017-09-10
 */
public class RestClient {
	
	private RestTemplate template=new RestTemplate();

	private String url ;

	public RestClient(String url){
		this.url=url;
	}
	public String show(String vars) {
		
		if(vars.length()==0){
			return template.getForObject(url, String.class,
					new String[] {});
		}
		else
			
		return template.getForObject(url, String.class,
				vars);
	}
	public String post(){
		return template.postForObject(url , null, String.class);
	}
	public String put(){
		template.put(url , null);
		return "success";
	}
	public String delete(){
		template.delete(url);
		return "success";
	}
}
